Page({
  onLoad({ point, building }) {
    this.fake(point, building)
  },
  data: {
    point: '',
    building: '',
    rooms: [],
  },
  fake(point, building) {
    const size = Math.floor(Math.random() * 4) + 7 // 房间数量 8
    const rooms = []
    for (let i = 0; i < size; i++) {
      // 楼层号生成 1 ~ 20
      const floor = Math.floor(Math.random() * 19) + 1
      // 具体的房间号生成 1 ~ 3
      const No = Math.floor(Math.random() * 2) + 1
      const room = floor + '0' + No
      // console.log(room)
      // 避免追加重复的房间
      if (rooms.includes(room)) continue
      rooms.push(room)
    }
    this.setData({ rooms, point, building })
  },
})
